<?php

class DBMLikeFilter implements DBMFilter {
	private $property;
	private $likeExpression;
	
	public function __construct($property, $likeExpression){
		$this->setProperty($property);
		$this->setLikeExpression($likeExpression);
	}
	
	public function getProperty(){
		return $this->property;
	}
	public function setProperty($property){
		$this->property = $property; 
	}
	public function setLikeExpression($likeExpression){
		$this->likeExpression = $likeExpression;
	}
	public function getLikeExpression(){
		return $this->likeExpression;
	}
	public function toSQL($databaseType, DBMCommand $command){
		if($databaseType == DBManager::TYPE_MSSQL){
			return DBMLikeFilterTranslator::translateToSQLServer($this, $command);	
		} elseif($databaseType == DBManager::TYPE_MYSQL){
			return DBMLikeFilterTranslator::translateToMySQL($this, $command);
		} elseif($databaseType == DBManager::TYPE_POSTGRESQL){
			return DBMLikeFilterTranslator::translateToPostgreSQL($this, $command);
		} else {
			throw new UnsupportedDatabaseException($databaseType);
		}
	}
}

?>
